/**
 * LeetCode100：相同的树
 * 给定两个二叉树，检验它们是否相同
 */

function TreeNode(val){
    this.val = val;
    this.left = this.right = null;
}

/**
 *
 * @param {TreeNode} p
 * @param {TreeNode} q
 * @return {boolean}
 */
var isSameTree = function (p,q){
    if (!p && !q){ return true;}
    if (p && q && p.val === q.val &&
        isSameTree(p.left,q.left) && isSameTree(p.right,q.right)){
        return true;
    }
    return false;
}